import request from '@/utils/http'

import mockRequest from '@/mock/mockAjax'
//获取商品详情
export function getGoodByIdAPI(goodId) {
  return request({
    url: '/goods/selectGoodsById',
    method: 'get',
    params: { goodId }
  })
}

//获取商品评论信息
export function getCommentListAPI(params) {
  return request({
    url: '/comment/getCommentList',
    method: 'get',
    params: params
  })
}

//获取商品的sku列表
export function getSkuListAPI(goodId) {
  return request({
    url: '/sku/selectByGoodId',
    method: 'get',
    params: { goodId }
  })
}

//新增商品的sku
export function addSkuAPI(data) {
  return request({
    url: '/sku/insertGoodSku',
    method: 'post',
    data: data
  })
}

//修改商品的sku
export function updateSkuAPI(data) {
  return request({
    url: '/sku/updateGoodSku',
    method: 'put',
    data: data
  })
}

//删除商品sku
export function deleteSkuAPI(skuId) {
  return request({
    url: '/sku/deleteGoodSku',
    method: 'post',
    params: { skuId }
  })
}


export function getGoodListAPI(query) {
  return request({
    url: '/good/goods/list',
    method: 'get',
    params: query
  })
}
// 获取商品列表
export function getGoodList() {
  return mockRequest({
    url: '/goodList',
    method: 'get'
  })

}

// 获取用户猜你喜欢列表
export function getLikeList(params) {
  return mockRequest({
    url: '/member/goodList',
    method: 'get',
    params: params
  })
}

// 搜索商品列表
// export function getGoods(params) {
//   return request({
//     url: '/good/search',
//     method: 'get',
//     params: params
//   })
// }
export function getGoods(query) {
  return request({
    url: '/good/good/list',
    method: 'get',
    params: query
  })
}
//搜索实体店列表
export function getStores(params) {
  return request({
    url: '/store/search',
    method: 'get',
    params: params
  })
}
//搜索批发商列表
export function getWholesalers(params) {
  return request({
    url: '/store/search',
    method: 'get',
    params: params
  })
}
//搜索加工厂列表
export function getFactorys(params) {
  return request({
    url: '/factory/search',
    method: 'get',
    params: params
  })
}

//获取商品分类列表
export function getCategory() {
  return request({
    url: '/good/category/list',
    method: 'get'
  })
}

